package cn.highedu.spring;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * 装备类
 */
//@Component
//@Scope("prototype")
public class Armor {
    // 属性注入 给对象的属性注入相应的值
    @Value("红莲斗篷") // @Value注解可以写在属性上 还可以写在set方法上
    private String name;
    @Value("2100") // 如果属性类型是数字等其他类型 注入的值必须是字符串类型
    private Double price;
    @Value("增加生命值, 提高防御力")
    private String desc;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    @Override
    public String toString() {
        return "Armor{" +
                "name='" + name + '\'' +
                ", price=" + price +
                ", desc='" + desc + '\'' +
                '}';
    }
}
